package com.thd.springboottest;

import org.camunda.bpm.engine.ProcessEngine;
import org.camunda.bpm.engine.ProcessEngines;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.transaction.PlatformTransactionManager;

import java.util.stream.Stream;

/**
 * 注意,如果集成activiti 一定要配置exclude={org.activiti.spring.boot.SecurityAutoConfiguration.class
 * Caused by: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
 */

@SpringBootApplication
public class Application extends SpringBootServletInitializer {

    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(this.getClass());
    }

    public static void main(String[] args) {
        //System.setProperty("spring.devtools.restart.enabled", "false");
        ConfigurableApplicationContext ctx = SpringApplication.run(Application.class, args);
//        String[] names = ctx.getBeanDefinitionNames();
//        Stream.of(names).forEach(System.out::println);



        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();//一直往下debug
        System.out.println("流程名称：" + processEngine.getName());
        System.out.println("配置类：" + processEngine.getProcessEngineConfiguration());
        System.out.println("鉴权：" + processEngine.getAuthorizationService());
        System.out.println("外部任务：" + processEngine.getExternalTaskService());
        System.out.println("过滤器：" + processEngine.getFilterService());

        System.out.println(processEngine.getFormService());
        System.out.println(processEngine.getHistoryService());

        System.out.println(processEngine.getIdentityService());
        System.out.println(processEngine.getManagementService());
        System.out.println(processEngine.getRepositoryService());
        System.out.println(processEngine.getRuntimeService());
        System.out.println(processEngine.getTaskService());
    }

}
